package pe.edu.sistemas.sisdiho.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidatorUtil {
	private static final String PATTERN_EMAIL = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
            + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
	
	private static final String PATTERN_ALPHAB = "[A-Za-z-,ñÑ'áéíóúÁÉÍÓÚ ]+";
	
	public static boolean validateEmail(String email) {
        Pattern pattern = Pattern.compile(PATTERN_EMAIL);
        Matcher matcher = pattern.matcher(email);
        return matcher.matches();
    }
	
	public static boolean validateAlphab(String cadena){
		Pattern pattern = Pattern.compile(PATTERN_ALPHAB);
        Matcher matcher = pattern.matcher(cadena);
        return matcher.matches();
	}
}
